<template>
  <el-dropdown>
    <span>{{userName}}</span>
    <el-dropdown @command="handleCommand">
      <el-button type="primary" icon="el-icon-edit" circle></el-button>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="logOut">退出登录</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </el-dropdown>
</template>

<script>
export default {
  name: "top",
  data() {
    return {
      userName:sessionStorage.getItem("userName")
    }
  },
  methods:{
    handleCommand(command) {
      sessionStorage.removeItem("token")
      this.$router.push("/login")
    }
  },
}
</script>

<style scoped>

</style>
